/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upgmadendro.diagram;

import java.util.ArrayList;
import upgmadendro.graph.Edge;
import upgmadendro.graph.Vertex;

/**
 *
 * @author Shadev
 */
public class DiagramStructure {

    private ArrayList<DiagramObject> objects = new ArrayList<DiagramObject>();

    public void updateStructure(Vertex v1, Vertex v2, Edge e1) {
        DiagramObject temp = new DiagramObject(v1.getName() + v2.getName());
        temp.setBorn(e1.getValue() / 2);
        for (DiagramObject o : objects) {
            if ((o.getName().equalsIgnoreCase(v1.getName())) ||
                    (o.getName().equalsIgnoreCase(v2.getName()))) {
                o.setDead(e1.getValue() / 2);
                o.setTurnsInto(temp);
            }
        }
        objects.add(temp);
    }

    public ArrayList<DiagramObject> getObjects() {
        return objects;
    }

    public void setObjects(ArrayList<DiagramObject> objects) {
        this.objects = objects;
    }
}
